#if ( !defined __PROXY_CHECKER_HPP__ )
#define __PROXY_CHECKER_HPP__

#define HOST_TEST_PROXY "119.40.35.7"
#define PATH_TEST_PROXY "/"

#include <string>
#include <vector>
#include <sstream>

#include "webpage_hunter.hpp"
#include "proxy_reader.hpp"

using namespace std;

class ProxyChecker
{
public:
	ProxyChecker ( const string& db_file );
	~ProxyChecker ();
public:
	void operator()();
protected:
	void read_test_webpage ( string& header, string& content );

	bool read_webpage( const string& server, const string& port, const string& host, const string path, HttpHeaderPairs& headers, ostream& header_stream, ostream& content_stream );
	void read_try ( int count, const string& server, const string& port, const string& host, const string path, HttpHeaderPairs& headers, ostream& header_stream, ostream& content_stream  );
	bool verify_webpage ( const string& header, const string& content, stringstream& header_stream, stringstream& content_stream );
	bool check ( const string& check_header, const string& check_content, const string& proxy, HttpHeaderPairs headers, int& seconds );
	void handle_check ( const string& check_header, const string& check_content, const string& proxy, HttpHeaderPairs headers, int& seconds );
private:
	ProxyReader* _reader;

};

#endif // __PROXY_CHECKER_HPP__